import { createStore } from "vuex"

import user from './modules/user'

export default createStore({
    state: {
        routeLoaded: false, // 菜单和路由是否已经加载
        firstRoute: null, // 第一个路由，用于进入主页时的重定向
        menuTree: null // 菜单树
    },
    mutations: {
        setRouteLoaded(state, routeLoaded) {
            state.routeLoaded = routeLoaded
        },
        setFirstRoute(state, route) {
            state.firstRoute = route
        },
        setMenuTree(state, data) {
            state.menuTree = data
        }
    },
    modules: {
        user
    }
})